<style type="text/css">
#edit-matter-details h3{
  border:1px solid #4A7EBB;
  background:#93CDDD;
  color:#000;
  padding:10px;
  text-align:center;
  margin: 20px 40px;
}

#edit-matter-table{
  margin-left:20px;
}
#edit-matter-table th{
  text-align:right;
}
#edit-matter-table td{
  text-align:left;
  height:10px;
}
.head-tab{
  color: #FFFFFF;
  background-color: #1E4262;
  -moz-border-radius: 4px;
  -webkit-border-radius: 4px;
  padding:5px 10px;
  margin-bottom:10px;
}

.row-tab{
  border:1px solid #888;
  background-color: #FFFFFF;
  border-radius: 4px;
  -moz-border-radius: 4px;
  -webkit-border-radius: 4px;
  padding:5px 10px;
  margin-top:5px;
  vertical-align: top;
}

.row-tab:hover {
  background-color: #AFB5C4;
  cursor: pointer;
}
.head-tab div{
  display:inline-block;
  text-align: center;
}

.row-tab div{
  display:inline-block;
  vertical-align:top;
/*  text-align: left; */
}

/* added for display*/

.matter-title{
  vertical-align: top;
  text-align: left !important;
  margin: 5px;
  width: 180px;
}

#parent-matter{
  color: #999 !important;
  float: left;
}

#container-matter{
  color: #BBB !important;
  float: left;
}

.matter-name{
  text-align:left !important;
  margin: 5px;
  width: 720px;
  min-height: 90px;
}

.actor-block{
  display: inline-block;
  width: 170px;
  margin: 0px 10px 10px 0px;
  vertical-align: top;
  overflow-x: hidden;
  white-space: nowrap;
  /*-webkit-mask-image: -webkit-linear-gradient(left, black 90%, transparent);
  -moz-mask-image: -moz-linear-gradient(left, black 90%, transparent);
  mask-image: linear-gradient(left, black 90%, transparent);
  //box-shadow: inset -5px -2px 10px #888888;*/
}

.row-head{
    background: none repeat scroll 0 0 #1E4262;
    color: wheat;
    text-align: center;
    width: 6%;
}
.list-matter-block {
    vertical-align: top;
    background: #B5D9E5;
    height: 23px;
}
.list-matter-block-info {
    display:inline-block;
    vertical-align: top;
    background-color: #FFFFFF;
    border: 1px solid #DDD;
    border-style:inset;
    -moz-border-radius: 4px;
    -webkit-border-radius: 4px;
    border-radius: 4px;
    height: 100px;
    padding:4px;
    overflow: auto;
    width: 98.5%;
}

.status-row{
display:block;
}
.status-col-name{
display:inline-block;
width: 150px;
vertical-align: top;
}
.status-col-date{
display:inline-block;
width: 125px;
vertical-align: top;
}

.status-col-number{
display:inline-block;
width: 125px;
vertical-align: top;
}

.status-col{
display:inline-block;
width: 150px;
vertical-align: top;
}

.task-col-name{
    display:inline-block;
    width: 300px;
    vertical-align: top;
}

.renewal-col-name{
display:inline-block;
width: 80px;
vertical-align: top;
}
.renewal-col-number{
display:inline-block;
width: 20px;
vertical-align: top;
}
.renewal-col-date{
display:inline-block;
width: 80px;
vertical-align: top;
}


.classifier-name{
display:inline-block;
width: 100px;
vertical-align: top;
}

.classifier-value{
  display:inline-block;
  vertical-align: top;
  max-width: 250px;
}
.classifier-main-name{
display:inline-block;
width: 80px;
vertical-align: top;
text-align:right;
margin-bottom: 4px;
}
.classifier-main-value{
padding-left:10px;
display:inline-block;
width: 450px;
vertical-align: top;
text-align:left;
}

#MatterStatus:hover, #MatterStatusPop:hover, #MatterOpenTasks:hover, #MatterRenTasks:hover, #MatterClassifier:hover {
    cursor: pointer;
}

#mapactor-pop-up, #tasklist-pop-up, #event-pop-up, #classifier-popup{
    display: none;
    position: absolute;
    background: transparent;
    z-index: 101; 
    -moz-box-shadow: 0px;
}

#mapactor-pop-up{
  position: fixed;
  margin: auto;
}

.help_cursor:hover {
    cursor: help;
}

.add-actor:hover {
    cursor: pointer;
}

/*#facade{
    position: absolute;
    top:0px;
    left:0px;
    height: 100%;
    width: 100%;
    background: black;
    opacity:0.4;
    filter:alpha(opacity=40);
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
    display:none;
    z-index: 100;
}*/
.matter-role{
    font-weight: bold;
}
.title-button{
  background: #C8E8F3;
  color: #000;
  text-shadow: 0 1px 0 #FFFFFF;
  padding: 2px 16px;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
}

#matter-main-titles{
    border: 1px inset #000;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
}

#title-action-div{
  float:right;
}
#title-action-div a{
  display: inline-block;
}
#title-action-div button{
  display:block !important;
  margin-bottom: 4px !important;
  width: 150px !important;
}
#responsible-actor-span{
  margin-left:300px;
}
#add-classifier-popup, #add-matter-popup{
  display:none;
  z-index: 101;
  top: 200px;
  position:fixed;
  width:auto;
}
.title-editable{
  display: inline-block;
  min-height:32px;
}
.matter-dead{
  color: #777 !important;
  text-decoration: line-through;
}
.actor-inherit{
  font-style: italic;
}
.matter-actor{
  cursor: pointer;
}
#actor-details-popup{
  display: none;
  z-index: 101;
  position: absolute;
  width: 670px;
}
#actor-details-nav{
  text-align:center;
}
#actor-details-nav img{
  margin-left: 10px;
  cursor: pointer;
}
#delete-actor{
  float:right;
  margin-top: 4px;
}

</style>

<script type="text/javascript">
$(document).ready(function(){
        $("#MatterStatus").click(function(event){
            ren_top = $(this).offset().top;
            $.ajax({
                type: "POST",
                url: "/matter/eventlist/id/<?=$this->matter_record[0]['ID']?>",
                data: {},
                success: function(data){
                	$('#event-pop-up').empty();
                    $('#event-pop-up').html(data);
                    $('#event-pop-up').css('top',ren_top - 5);
                }
            });
            $('#event-pop-up').css('display','block');
        }); 

        $("#MatterOpenTasks").click(function(event){   
            ren_top = $(this).offset().top;
            $.ajax({
                type: "POST",
                url: "/matter/tasklist/matter_id/<?=$this->matter_record[0]['ID']?>",
                data: {},
                success: function(data){
                	$('#tasklist-pop-up').empty();
                    $('#tasklist-pop-up').html(data);
                    $('#tasklist-pop-up').css('top',ren_top - 5);
                }
            });
            $('#tasklist-pop-up').css('display','block');
        }); 

        $("#MatterRenTasks").click(function(event){
            ren_top = $(this).offset().top;
            $.ajax({
                type: "POST",
                url: "/matter/tasklistren/id/<?=$this->matter_record[0]['ID']?>",
                data: {},
                success: function(data){
                	$('#tasklist-pop-up').empty();
                    $('#tasklist-pop-up').html(data);
                    $('#tasklist-pop-up').css('top',ren_top - 5);
                }
            });
            $('#tasklist-pop-up').css('display','block');
        }); 

        $("#MatterClassifier").click(function(event){
            ren_top = $(this).offset().top;
            $.ajax({
                type: "POST",
                url: "/matter/classifierlist/id/<?=$this->matter_record[0]['ID']?>",
                data: {},
                success: function(data){
                	$('#classifier-popup').empty();
                    $('#classifier-popup').html(data);
                    $('#classifier-popup').css('top',ren_top - 5);
                }
            });
            $('#classifier-popup').css('display','block');
        });
 
        $(".add-actor").click(function(event){
            role = $(this).attr('id').split('-');
            $('#facade').css('height',$(document).height());
            $('#facade').css('display','block');
            $.ajax({
                type: "POST",
                url: "/matter/map-actor-role/id/<?=$this->matter_record[0]['ID']?>/role/" + role[2],
                data: {},
                success: function(data){
                	$('#mapactor-pop-up').empty();
                    $('#mapactor-pop-up').html(data);
                    $('#mapactor-pop-up').css('top',200);
                    $('#mapactor-pop-up').css('left',200);
                }
            });
            $('#mapactor-pop-up').css('display','block');
        });

        $(".matter-role").click(function(){
            //ren_left = Math.round($(window).width()/2) - Math.round($('#mapactor-pop-up').width()/2);
            matter_role_id = $(this).attr('id').split('-');
            container_id = matter_role_id[2];
            role_id = matter_role_id[3];
            matter_id = $('input[name=matterId]').val();
            $('#facade').css('height',$(document).height());
            $('#facade').css('display','block');
            $.ajax({
                type: "POST",
                url:"/matter/role-actors/",
                data: { matter_id:matter_id , container_id:container_id, role_id:role_id },
                success: function(data){
                	$('#mapactor-pop-up').empty();
                    $('#mapactor-pop-up').html(data);
                    $('#mapactor-pop-up').css('width','840px');
                    $('#mapactor-pop-up').css('top',150);
                    $('#mapactor-pop-up').css('left', 50);
                }
            });
            $('#mapactor-pop-up').css('display','block');
        });

        $('#add-classifier-link').click(function(){
            var cat_code = $(this).attr('code');
            $('#facade').css('height', $(document).height());
            $('#facade').css("display", "block");
            $.ajax({
                type: "GET",
                url: "/matter/add-title/cat_code/"+cat_code,
                data: {},
                success: function(data){
                	$('#add-classifier-popup').empty();
                    $('#add-classifier-popup').html(data);
                    //var ren_left = Math.round($(window).width()/2) - Math.round($('#add-classifier-popup').width()/2);
                    $('#add-classifier-popup').css('left', 200);
                }
            });
            $('#add-classifier-popup').css('display', 'block');
        });

        $('#clone-matter-link').click(function(){
          var catid = $(this).attr('code');
          var country = $(this).attr('country');
          var origin = $(this).attr('origin');
          var type = $(this).attr('type');

          $('#facade').css('height', $(document).height());
          $('#facade').css("display", "block");
          $.ajax({
            url: '/matter/clone',
            type: 'GET',
            data: { category_id : catid, country: country, origin: origin, type: type },
            success: function(data){
            	$('#add-matter-popup').empty();
              	$('#add-matter-popup').html(data);
            	$('#add-matter-popup').css('left', 200);
            }
          });
          $('#add-matter-popup').css('display', 'block');
        });
                  
        $('#child-matter-link').click(function(){
          var catid = $(this).attr('code');
          var country = $(this).attr('country');
          var origin = $(this).attr('origin');
          var type = $(this).attr('type');
          var caseref = $(this).attr('caseref');

          $('#facade').css('height', $(document).height());
          $('#facade').css("display", "block");
          $.ajax({
            url: '/matter/child',
            type: 'GET',
            data: { caseref : caseref, category_id : catid, country: country, origin: origin, type: type },
            success: function(data){
            	$('#add-matter-popup').empty();
              	$('#add-matter-popup').html(data);
            	$('#add-matter-popup').css('left', 200);
            }
          });
          $('#add-matter-popup').css('display', 'block');
        });

        $('#national-matter-link').click(function(){
          var catid = $(this).attr('code');
          var country = $(this).attr('country');
          var caseref = $(this).attr('caseref');

          $('#facade').css('height', $(document).height());
          $('#facade').css('display', 'block');
          $.ajax({
            url: '/matter/national',
            type: 'GET',
            data: { caseref: caseref, category_id : catid, country : country },
            success: function(data){
            	$('#add-matter-popup').empty();
              	$('#add-matter-popup').html(data);
            	$('#add-matter-popup').css('left', 200);
            }
          });
          $('#add-matter-popup').css('display', 'block');
        });

        $('.title-editable').editable('/matter/edit-classifier', {
            type: 'textarea',
            submitdata: function(value,settings){
              var cid = $(this).attr('id');
              return { cid : cid }
            },
            select: true,
            submit: 'OK',
            cancel: 'X',
            indicator: '<span class="icon-busy" />',
            placeholder: '',
            tooltip: 'Click to edit...',
        });

        $('#matter-notes').editable('/matter/update-matter', {
            type: 'textarea',
            submitdata: function(value,settings){
              return { matter_id : $('#this-matter-id').val(), field: 'notes' }
            },
            submit: 'OK',
            cancel: 'X',
            select: true,
            indicator : '<span class="icon-busy" />',
            placeholder: '...',
            tooltip: 'Click to edit...',
            data: function(value, settings){
               return value.replace(/(<br>)*/g, '');
            }
        });

    $('#current-matter-edit').click(function(){
      $('#facade').css('height', $(document).height());
      $('#facade').css("display", "block");

      var mid = $('#this-matter-id').val();
      $.ajax({
        type: "GET",
        url: "/matter/edit/mid/"+mid,
        data: {},
        success: function(data){
        	$('#add-matter-popup').empty();
          	$('#add-matter-popup').html(data);
          	//var ren_left = Math.round($(window).width()/2) - Math.round($('#add-matter-popup').width()/2);
          	$('#add-matter-popup').css('left', 200);
        }
      });
      $('#add-matter-popup').css('display', 'block');
    });

    $('#add-classifier-link').hide();
    $('#matter-main-titles').mouseover(function(){
        $('#add-classifier-link').show();
    }).mouseout(function(){
        $('#add-classifier-link').hide();
    });

    $('.matter-actor').click(function(){
    var actor_id = $(this).attr('id');
      $('#facade').css('height',$(document).height());
      $('#facade').css('display','block');
      $.ajax({
        url: '/matter/actor/',
        type: 'POST',
        data: { actor_id:actor_id },
        success: function(data){
          $('#actor-details-popup').empty();
          $('#actor-details-popup').html(data);
          //ren_left = Math.round($(window).width()/2) - Math.round($('#actor-details-popup').width()/2);
          $('#actor-details-popup').css('left', 200);
          $('#actor-details-popup').css('top', 50);
        }
      });
      $('#actor-details-popup').css('display', 'block');
    });
                  
    $( "button, input:submit, input:button").button();

});
</script>  

<div class="head-tab">
<?php if($this->matter_record[0]['dead'])
        $matter_dead = "matter-dead";
      else
        $matter_dead = "";
?>
	<div class="matter-title">
    <?php echo $this->matter_record[0]['category'] ."</br>";?>
    <span style="color: white; font-size: 16px; margin-right: 5px; float: left;" class="<?=$matter_dead?>"><?php echo $this->matter_record[0]['UID']; ?> <button id="current-matter-edit" title="Advanced edit" style="background: transparent; border: transparent;"><span class="ui-icon ui-icon-wrench"></span></button></span>

	<?php
	if($this->matter_parent){
		echo "<br /><a id='parent-matter' href='/matter/view/id/" .  $this->matter_parent[0]['ID']  . "' title='See parent'>" . $this->matter_parent[0]['UID'];
        echo  " (" . $this->matter_parent[0]['category_code'] . ")</a>"; 
    } 
	if($this->matter_container){
		echo "<br /><a id='container-matter' href='/matter/view/id/" .  $this->matter_container[0]['ID']  . "' title='See container'>" . $this->matter_container[0]['UID'];
        echo  " (" . $this->matter_container[0]['category_code'] . ")</a>";
    }?>



	</div>
<div class="matter-name">

<div id="title-action-div">
<button id="clone-matter-link" country="<?=$this->matter_record[0]['country_name']?>-<?=$this->matter_record[0]['country']?>" origin="<?=$this->matter_record[0]['origin']?>" type="<?=$this->matter_record[0]['type_code']?>" code="<?=$this->matter_record[0]['category']?>-<?=$this->matter_record[0]['category_code']?>"><span class="ui-icon ui-icon-copy" style="float: left;"></span>Clone matter</button>
<button id="child-matter-link" caseref="<?=$this->matter_record[0]['caseref']?>" country="<?=$this->matter_record[0]['country_name']?>-<?=$this->matter_record[0]['country']?>" origin="<?=$this->matter_record[0]['origin']?>" type="<?=$this->matter_record[0]['type_code']?>" code="<?=$this->matter_record[0]['category']?>-<?=$this->matter_record[0]['category_code']?>"><span class="ui-icon ui-icon-link" style="float: left;"></span>New child</button>
<?php if($this->national_phase){ ?>
<button id="national-matter-link" caseref="<?=$this->matter_record[0]['caseref']?>" country="<?=$this->matter_record[0]['country_name']?>-<?=$this->matter_record[0]['country']?>" origin="<?=$this->matter_record[0]['origin']?>" type="<?=$this->matter_record[0]['type_code']?>" code="<?=$this->matter_record[0]['category']?>-<?=$this->matter_record[0]['category_code']?>"><span class="ui-icon ui-icon-flag" style="float: left;"></span>Enter nat. phase</button>
<?php } ?>
</div>


<?php 
foreach($this->matter_classifier_main as $classifier):
$cid = $classifier['ID'];
    if($classifier['c_value']){
        $classifier_arr[$classifier['type']] = isset($classifier_arr[$classifier['type']])? $classifier_arr[$classifier['type']].' ; <span class="title-editable" id="'.$cid.'" >'.htmlentities($classifier['c_value']).'</span>' : '<span class="title-editable" id="'.$cid.'" >'.htmlentities($classifier['c_value']).'</span>';
    }
    if($classifier['cv_value'])
        $classifier_arr[$classifier['cv_type']] = isset($classifier_arr[$classifier['cv_type']])? $classifier_arr[$classifier['cv_type']].' ; <span class="title-editable" >'.htmlentities($classifier['cv_value']) . '</span>' : '<span class="title-editable" >' . htmlentities($classifier['cv_value']). '</span>';
    if($classifier['lnk_matter_id']){
        $classifier_arr[$classifier['type']] = "<a href='/matter/view/id/" . $classifier['lnk_matter_id'] .  "'>" . $classifier['caseref'] . "</a> " . $classifier['country'] . " " . $classifier['origin'] . " " . $classifier['matter_type'];
    }
endforeach;
if($this->matter_classifier_container_main):
foreach($this->matter_classifier_container_main as $classifier):
$cid = $classifier['ID'];
    if($classifier['c_value']){
        $classifier_arr[$classifier['type']] = (isset($classifier_arr[$classifier['type']]) && $classifier_arr[$classifier['type']])? $classifier_arr[$classifier['type']].' ; <span class="title-editable" id="'.$cid.'" >'.htmlentities($classifier['c_value']) . '</span>': '<span class="title-editable" id="'.$cid.'" >'.htmlentities($classifier['c_value']) . '</span>';
    }
    if($classifier['cv_value']){
        $classifier_arr[$classifier['cv_type']] = isset($classifier_arr[$classifier['cv_type']])? $classifier_arr[$classifier['cv_type']].' ; <span class="title-editable" >'.htmlentities($classifier['cv_value']) . '</span>': '<span class="title-editable" >'.htmlentities($classifier['cv_value']) .'</span>';
    }
    if($classifier['lnk_matter_id']){
        $classifier_arr[$classifier['type']] = "<a href='/matter/view/id/" . $classifier['lnk_matter_id'] .  "'>" . $classifier['caseref'] . "</a> " . $classifier['country'] . " " . $classifier['origin'] . " " . $classifier['matter_type'];
    }
endforeach;
endif;

?>
<div id="matter-main-titles">
<?php if(count($classifier_arr)){ ?> 

<?php foreach($classifier_arr as $type => $value): ?>
<div class="" style="margin:5px 0px; display:block; text-align:left;"><span class="classifier-main-name"><b><?=$type?></b></span><span class="classifier-main-value" ><?php echo $value;?></span></div>
<?php  endforeach; 
    } else
        echo "...Hover the mouse here to add a title item..."; 
?>
<button id="add-classifier-link" code="<?=$this->matter_record[0]['category_code']?>" style="position: absolute; width: 120px; margin-left: 50px"><span class="ui-icon ui-icon-plusthick" style="float: left;"></span>Add title item</button>
</div>

</div>
</div>

<?php if(isset($this->matter_actors)):
    $div_start = 1;
    $actor_role = "";
?>
<div class="listrow">
<div class="list-matter-block" > Actors<span id="responsible-actor-span">Responsible: <?=$this->matter_record[0]['responsible']?></span>  <button style="float:right; margin-top: -2px;" id="new-actor-0" class="add-actor">Add Actor</button></div>
<div class="list-matter-block-info" style="height: 150px; width: 99%">
<input type="hidden" name="matterId" id="this-matter-id" value=<?=$this->matter_id?> />
<input type="hidden" name="containerId" id="this-container-id" value="<?=$this->matter_record[0]['container_ID']?>" />
<?php
foreach($this->matter_actors as $actor):
        //print_r($actor);
	if($actor['role_name'] != ""){
	    if($actor_role != $actor['role_name']){
            if($div_start == 0)
	    		echo "</div>";
            $div_start = 0;
	    	$actor_role = $actor['role_name'];
            echo "<div class='actor-block'>";
	        echo '<a href="javascript:void(0);" class="matter-role" id="matter-role-'. $actor['matter_ID'] .'-'.$actor['role'].'" >' . $actor['role_name'] . "</a><span class='add-actor' id='add-actor-" . $actor['role']  . "' title='Add Actor'> <b>+</b></span><br>";
	  }else
		echo "<br />";
	    $actor_display_name = ($actor['display_name'] == "" ) ? $actor['name'] .  (($actor['first_name']) ? (", " . $actor['first_name']) : "") : $actor['display_name'];

	    if($actor['actor_ref'])
	    	$actor_display_name .=  " (" . $actor['actor_ref'] . ")";

	    if($actor['company_name'])
	        $actor_display_name .=  " - " . $actor['company_name'];

	    if(strlen($actor_display_name) > 23)
	        echo  "<span id='".$actor['ID']."' class='matter-actor help_cursor".($actor['inherited']?" actor-inherit":"")."' title='". htmlentities($actor_display_name) . "'>" . htmlentities($actor_display_name) . "</span>";
	    else
	    	echo  "<span id='".$actor['ID']."' class='matter-actor ".($actor['inherited']?" actor-inherit":"")."' >".htmlentities($actor_display_name)."</span>";
  }
endforeach;
if(count($this->matter_actors))
	echo "</div>";
 ?>
</div>
</div>
<?php endif; ?>

<?php //Matter Events?>
<div class="listrow" style="width: 462px; display: inline-block;">
<div class="status-row" id="MatterStatus" style="margin-left: 5px;" title="Click for more detail"><span class="status-col-name">Status</span><span class="status-col-date">Date</span><span class="status-col-number">Number</span><span style="float:right;" class="ui-icon ui-icon-newwin"></span></div>
<div class="list-matter-block-info" style="width:98%" >

<?php foreach($this->matter_events as $event):
    if ($this->matter_record[0]['origin'] == 'EP') $CC = 'EP';
    else $CC = $this->matter_record[0]['country'];
    $country_code = $this->matter_record[0]['country'];
    $removethese = array("/^$country_code/",'/ /', '/,/', '/-/', '/\//', '/\.[0-9]/');
    $cleanednumber = preg_replace($removethese, '', $event['detail']);
    $href = '';
    if($event['alt_matter_ID'] !=  "")
        $href = '/matter/view/id/' . $event['alt_matter_ID'];
    else if ($event['code'] == 'PUB' || $event['code'] == 'GRT') {
        // Fix US pub number for Espacenet by keeping the last 6 digits after the year
        if ($CC == 'US' && $event['code'] == 'PUB') $cleanednumber = substr($cleanednumber, 0, 4) . substr($cleanednumber, -6);
        $href = 'http://worldwide.espacenet.com/publicationDetails/biblio?DB=EPODOC&CC=' . $CC . '&NR=' . $cleanednumber;
    }
    else if ($event['code'] == 'FIL' && $country_code == 'EP')
        $href = 'https://register.epo.org/espacenet/application?number=EP' . $cleanednumber;
    else if($event['code'] == 'FIL' && $country_code == 'FR')
        $href = 'http://regbrvfr.inpi.fr/register/application?number=' . $CC . $cleanednumber;
    ?> 
<div class="status-row"><span class="status-col-name"><?=$event['name']?></span><span class="status-col-date"><?=$event['event_date']?></span><span class="status-col-number" ><? if($href !=  ""){ ?><a href="<?=$href?>" target="_blank"><?=$event['detail']?></a><?} else {?><?=$event['detail']?><?}?></span></div>
<?php endforeach; ?>

</div>

</div>

<?php // Matter Open Tasks
$trigger_id = "";
?>
<div class="listrow" style="width: 462px; display: inline-block;">
<div class="status-row" id="MatterOpenTasks" style="margin-left: 5px;" title="Click for more detail"><span class="task-col-name">Open tasks</span><span class="status-col-date" >Due</span><span style="float:right;" class="ui-icon ui-icon-newwin"></span></div>
<div class="list-matter-block-info" style="width:98%" >
<?php foreach($this->matter_open_tasks as $open_task): 
    if($trigger_id != $open_task['trigger_ID']){
       $trigger_id = $open_task['trigger_ID'];
 ?>

<div class="status-row" style="border-bottom: 1px solid #DDD; margin-top: 2px;"><span class="task-col-name"><b><?=$open_task['trigger_name'] ." - ". $open_task['trigger_detail'] ?></b></span><span class="status-col-date"></span></div>
<?php  }

    if($trigger_id == $open_task['trigger_ID']){
?> 
<div class="status-row"><span class="task-col-name help_cursor" title="<?=htmlentities($open_task['notes']) ?>"><?=$open_task['task_name']?>
<? if($open_task['detail'] != "")
    echo ": " . $open_task['detail'] ?></span>
<span class="status-col-date" ><?=$open_task['due_date']?></span></div>
<?php }
      
endforeach; ?>
</div>
</div>


<?php //Matter Opent Task Renewals
$trigger_id = "";
?>
<div class="listrow" style="display: inline-block; width: 200px !important;">
<div class="status-row" id="MatterRenTasks" title="Click for more detail"><span class="renewal-col-name">Renewals</span><span class="renewal-col-date" >Due</span><span style="float:right;" class="ui-icon ui-icon-newwin"></span></div>
<div class="list-matter-block-info" style="width:97%" >
<?php foreach($this->matter_open_tasks_ren as $open_task): 
    if($trigger_id != $open_task['trigger_ID']){
       $trigger_id = $open_task['trigger_ID'];
 ?>

<div class="status-row" style="margin:5px 0px; border-bottom: 1px solid #DDD;"><span class="renewal-col-name">From: <b><?=$open_task['trigger_name']?></b></span><span class="renewal-col-date"></span><span class="renewal-col-number" ></span></div>
<?php  }

    if($trigger_id == $open_task['trigger_ID']){
?> 
<div class="status-row"><span class="renewal-col-name"><?=$open_task['detail']?></span><span class="renewal-col-date" ><?=$open_task['due_date']?></span></div>
<?php }
      
endforeach; ?>
<div class="status-row">&nbsp;</div>
<?php if(isset($this->matter_expiry)):
echo "Expiry: ".$this->matter_expiry['expire_term']; echo ($this->matter_expiry['term_adjust'] > 0)? " ( PTA: ".$this->matter_expiry['term_adjust']." days )" : "" ;
endif; ?>

</div>
</div>


<?php //Matter Classifier
$trigger_id = "";
?>
<div class="listrow" style="display: inline-block; width: 394px !important;">
<div class="status-row" id="MatterClassifier" title="Click for more detail"><span class="status-col-name">Classifier</span><span style="float:right;" class="ui-icon ui-icon-newwin"></span></div>
<div class="list-matter-block-info" style="width:98%" >


<?php 
$ctype = "";
$close_type = 0;
$count = 0;
foreach($this->classifiers as $classifier){ 
  if($ctype != $classifier['type']){
    $ctype = $classifier['type'];

    if($close_type){
      echo "</div>";
      $count = 0;
    }
?>

<div class="status-row" style="margin:5px 0px;"><span class="classifier-name"><b><?=$classifier['type']?></b></span>
<?php $close_type=1; } 
if($ctype == $classifier['type']){
if($count > 0)
  echo "&#08;;&nbsp;";
$count++;
$show_title=0;
$classifier_value = substr($classifier['value'], 0, 80);
if(strlen($classifier['value']) > 80){
  $classifier_value .= ' ...';
  $show_title=1;
}
?>
<span class="classifier-value" title="<?php echo ($show_title)?$classifier['value']:'';?>"  >
<?php if($classifier['url'] == '')
        echo $classifier_value;
      else
        echo '<a href="'.$classifier['url'].'" target="_blank">'.$classifier_value.'</a>'; ?>

</span>
<?
 } } 

    if($close_type)
      echo "</div>";
?>

</div>
</div>

<?php //notes?>
<div class="listrow" style="display: inline-block; width: 304px">
<div class="status-row"><span class="status-col-name">Notes</span></div>
<div class="list-matter-block-info" style="width:97%" >
<div class="status-row" style="margin:5px 5px; min-height: 55px; " id="matter-notes"><?=nl2br(htmlentities($this->matter_record[0]['notes']))?>
</div>
</div>
</div>

<div id="event-pop-up"></div>
<div id="tasklist-pop-up"></div>
<div id="classifier-popup"></div>
<div id="mapactor-pop-up"></div>

<div id="add-classifier-popup">
    <input type="hidden" value="<?=$this->matter_id?>" id="matter-id" />
</div>
<div id="add-matter-popup"></div>

<div id="actor-details-popup" class="place-card" >
</div>
<div id="facade"></div>
